home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Devices / CD-ROM / iso9660 / Srcs / HighSierra.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-28  |  9.0 KB  |  300 lines  |  [TEXT/MPS ]

  1. /****************************************************************************/
  2. /*                                                                            */
  3. /*    File:         HighSierra.h                                                */
  4. /*                                                                            */
  5. /*    Prefix:        HS,CD                                                        */
  6. /*                                                                            */
  7. /*    Purpose:    Provide type and constant definitions relating to High        */
  8. /*                Sierra format CDs.                                            */
  9. /*                                                                             */
  10. /*    Revision History:                                                        */
  11. /*                                                                             */
  12. /****************************************************************************/
  13. /*    Copyright © Apple Computer, Inc. 1987, 1988, 1990                        */
  14. /****************************************************************************/
  15.  
  16.  
  17. /****************************************************************************/
  18. /*    Exported Constants                                                        */
  19. /****************************************************************************/
  20.  
  21. #define    CDBLKSIZE    2048
  22. #define    HSVOLSTART    16        /* where we expect a Primary Volume Descriptor */
  23. #define HSTERMSTART    17        /* where we expect the Volume Descriptor Terminator */
  24.  
  25. #define StdVolType    1        /* Primary Volume Descriptor type */
  26. #define    VolEndType    255        /* Volume Descriptor Set Terminator type */ 
  27.  
  28. /*
  29.  * File Flags for Directory Records
  30.  */
  31. #define existenceBit    0x01
  32. #define directoryBit    0x02
  33. #define associatedBit    0x04
  34. #define recordBit        0x08
  35. #define protectionBit    0x10
  36. #define multiextentBit    0x80
  37.  
  38. /****************************************************************************/
  39. /*    Exported Types                                                            */
  40. /****************************************************************************/
  41.  
  42. typedef unsigned char byte;
  43.  
  44. /****************************************************************************/
  45. /*    We need to ensure that these structures are aligned properly            */
  46. /****************************************************************************/
  47. #if defined(powerc) || defined (__powerc)
  48. #pragma options align=mac68k
  49. #endif
  50.  
  51. #ifdef HIGHSIERRA
  52.  
  53. /****************************************************************************/
  54. /*    High Sierra (May 26, 1986) Standard                                        */
  55. /****************************************************************************/
  56. /* 
  57.  * Primary Volume Descriptor (PVD)
  58.  */
  59. typedef struct
  60. {
  61.     long    lsbLogicalBlockNumber;
  62.     long    msbLogicalBlockNumber;
  63.     byte    VDType;                    /* Must be 1 for PVD */
  64.     char    VSStdId[5];                /* Must be "CDROM" */
  65.     byte    VSStdVersion;            /* Must be 1 */
  66.     byte    Reserved1;                /* Must be 0's */
  67.     char    systemIdentifier[32];
  68.     char    volumeIdentifier[32];
  69.     char    Reserved2[8];            /* Must be 0's */
  70.     long    lsbVolumeSpaceSize;
  71.     long    msbVolumeSpaceSize;
  72.     char    Reserved3[32];            /* Must be 0's */
  73.     short    lsbVolumeSetSize;
  74.     short    msbVolumeSetSize;
  75.     short    lsbVolumeSetSequenceNumber;
  76.     short    msbVolumeSetSequenceNumber;
  77.     short    lsbLogicalBlockSize;
  78.     short    msbLogicalBlockSize;
  79.     long    lsbPathTableSize;
  80.     long    pathTableSize;
  81.     long    lsbPathTable1;            /* mandatory occurrence */
  82.     long    lsbPathTable2;            /* optional occurrence */
  83.     long    lsbPathTable3;            /* optional occurrence */
  84.     long    lsbPathTable4;            /* optional occurrence */
  85.     long    msbPathTable1;            /* mandatory occurrence */
  86.     long    msbPathTable2;            /* optional occurrence */
  87.     long    msbPathTable3;            /* optional occurrence */
  88.     long    msbPathTable4;            /* optional occurrence */
  89.     char    rootDirectoryRecord[34];
  90.     char    volumeSetIdentifier[128];
  91.     char    publisherIdentifier[128];
  92.     char    dataPreparerIdentifier[128];
  93.     char    applicationIdentifier[128];
  94.     char    copyrightFileIdentifier[32];
  95.     char    abstractFileIdentifier[32];
  96.     char    volumeCreation[16];
  97.     char    volumeModification[16];
  98.     char    volumeExpiration[16];
  99.     char    volumeEffective[16];
  100.     char    FileStructureStandardVersion;
  101.     char    Reserved4;                /* Must be 0's */
  102.     char    ApplicationUse[512];
  103.     char    FutureStandardization[680];
  104. } PVD, *PVDPtr;
  105.  
  106. /*
  107.  * Path Table
  108.  */
  109.  
  110. typedef char    dirIDArray[8];
  111.  
  112. typedef struct
  113. {
  114.     long    dirLocation;    /* 1st logical block where directory is stored */
  115.     byte    XARlength;    /* Extended Attribute Record Length */
  116.     byte    len_di;            /* length of directory identifier */
  117.     short    parentDN;        /* parent directory number */
  118.     dirIDArray    dirID;        /* directory identifier: actual length is
  119.                              *    9 - [8+Len_di]; there is an extra blank
  120.                              *    byte if Len_di is odd.
  121.                              */
  122. } PathTableRecord, *PathTableRecordPtr;
  123.  
  124. /*
  125.  * Directory Record
  126.  *    There exists one of these for each file in the directory.
  127.  *    
  128.  */
  129. typedef struct
  130. {
  131.     char    macFlag[2];        /* $42 $41 - 'BA' famous value */
  132.     byte    systemUseID;    /* 06 = HFS */
  133.     byte    fileType[4];    /* such as 'TEXT' or 'STAK' */
  134.     byte    fileCreator[4];    /* such as 'hscd' or 'WILD' */
  135.     byte    finderFlags[2];
  136. } OldAppleExtension;
  137.  
  138. typedef struct
  139. {
  140.     char    signature[2];        /* $41 $41 - 'AA' famous value */
  141.     byte    extensionLength;    /* $0E for this ID */
  142.     byte    systemUseID;    /* 02 = HFS */
  143.     byte    fileType[4];    /* such as 'TEXT' or 'STAK' */
  144.     byte    fileCreator[4];    /* such as 'hscd' or 'WILD' */
  145.     byte    finderFlags[2];
  146. } AppleExtension;
  147.  
  148.  
  149. typedef struct
  150. {
  151.     byte    len_dr;            /* directory record length */
  152.     byte    XARlength;    /* Extended Attribute Record Length */
  153.     long    lsbStart;
  154.     long    msbStart;            /* 1st logical block where file starts */
  155.     long    lsbDataLength;
  156.     long    msbDataLength;
  157.     byte    year;            /* since 1900 */
  158.     byte    month;
  159.     byte    day;
  160.     byte    hour;
  161.     byte    minute;
  162.     byte    second;
  163.     byte    fileFlags;
  164.     byte    reserved;        /* must be 0 */
  165.     byte    interleaveSize;
  166.     byte    interleaveSkip;
  167.     short    lsbVolSetSeqNum;
  168.     short    msbVolSetSeqNum;    /* which volume in volume set contains this file. */
  169.     byte    len_fi;                /* length of file identifier which follows */
  170.     char    fi[34];                /* file identifier: actual is 34-[33+Len_fi].
  171.                                     contains extra blank byte if Len_fi odd */
  172.     AppleExtension    apple;        /* this actually fits immediately after the fi[] */
  173.                                 /* field, or after its padding byte. */
  174. } DirRcd, *DirRcdPtr;
  175.     
  176. #endif
  177.  
  178.  
  179. /****************************************************************************/
  180. /*    ISO 9660 (pANS Z39.86 198x) standard format                                */
  181. /****************************************************************************/
  182.  
  183. /* 
  184.  * Primary Volume Descriptor (PVD)
  185.  */
  186. typedef struct
  187. {
  188.     byte    VDType;                    /* Must be 1 for PVD */
  189.     char    VSStdId[5];                /* Must be "CD001" */
  190.     byte    VSStdVersion;            /* Must be 1 */
  191.     byte    Reserved1;                /* Must be 0's */
  192.     char    systemIdentifier[32];
  193.     char    volumeIdentifier[32];
  194.     char    Reserved2[8];            /* Must be 0's */
  195.     long    lsbVolumeSpaceSize;
  196.     long    msbVolumeSpaceSize;
  197.     char    Reserved3[32];            /* Must be 0's */
  198.     short    lsbVolumeSetSize;
  199.     short    msbVolumeSetSize;
  200.     short    lsbVolumeSetSequenceNumber;
  201.     short    msbVolumeSetSequenceNumber;
  202.     short    lsbLogicalBlockSize;
  203.     short    msbLogicalBlockSize;
  204.     long    lsbPathTableSize;
  205.     long    msbPathTableSize;
  206.     long    lsbPathTable1;            /* mandatory occurrence */
  207.     long    lsbPathTable2;            /* optional occurrence */
  208.     long    msbPathTable1;            /* mandatory occurrence */
  209.     long    msbPathTable2;            /* optional occurrence */
  210.     char    rootDirectoryRecord[34];
  211.     char    volumeSetIdentifier[128];
  212.     char    publisherIdentifier[128];
  213.     char    dataPreparerIdentifier[128];
  214.     char    applicationIdentifier[128];
  215.     char    copyrightFileIdentifier[37];
  216.     char    abstractFileIdentifier[37];
  217.     char    bibliographicFileIdentifier[37];
  218.     char    volumeCreation[17];
  219.     char    volumeModification[17];
  220.     char    volumeExpiration[17];
  221.     char    volumeEffective[17];
  222.     char    FileStructureStandardVersion;
  223.     char    Reserved4;                /* Must be 0's */
  224.     char    ApplicationUse[512];
  225.     char    FutureStandardization[653];
  226. } PVD, *PVDPtr;
  227.  
  228. /*
  229.  * Path Table
  230.  */
  231.  
  232. typedef char    dirIDArray[8];
  233.  
  234. typedef struct
  235. {
  236.     byte    len_di;            /* length of directory identifier */
  237.     byte    XARlength;    /* Extended Attribute Record Length */
  238.     long    dirLocation;    /* 1st logical block where directory is stored */
  239.     short    parentDN;        /* parent directory number */
  240.     dirIDArray    dirID;        /* directory identifier: actual length is
  241.                              *    9 - [8+Len_di]; there is an extra blank
  242.                              *    byte if Len_di is odd.
  243.                              */
  244. } PathTableRecord, *PathTableRecordPtr;
  245.  
  246. /*
  247.  * Directory Record
  248.  *    There exists one of these for each file in the directory.
  249.  *    
  250.  */
  251. typedef struct
  252. {
  253.     char    macFlag[2];        /* $42 $41 - 'BA' famous value */
  254.     byte    systemUseID;    /* 06 = HFS */
  255.     byte    fileType[4];    /* such as 'TEXT' or 'STAK' */
  256.     byte    fileCreator[4];    /* such as 'hscd' or 'WILD' */
  257.     byte    finderFlags[2];
  258. } OldAppleExtension;
  259.  
  260.  
  261. typedef struct
  262. {
  263.     char    signature[2];        /* $41 $41 - 'AA' famous value */
  264.     byte    extensionLength;    /* $0E for this ID */
  265.     byte    systemUseID;    /* 02 = HFS */
  266.     byte    fileType[4];    /* such as 'TEXT' or 'STAK' */
  267.     byte    fileCreator[4];    /* such as 'hscd' or 'WILD' */
  268.     byte    finderFlags[2];
  269. } AppleExtension;
  270.  
  271.  
  272. typedef struct
  273. {
  274.     byte    len_dr;                /* directory record length */
  275.     byte    XARlength;            /* Extended Attribute Record Length */
  276.     long    lsbStart;
  277.     long    msbStart;            /* 1st logical block where file starts */
  278.     long    lsbDataLength;
  279.     long    msbDataLength;
  280.     byte    year;                /* since 1900 */
  281.     byte    month;
  282.     byte    day;
  283.     byte    hour;
  284.     byte    minute;
  285.     byte    second;
  286.     byte    gmtOffset;
  287.     byte    fileFlags;
  288.     byte    interleaveSize;
  289.     byte    interleaveSkip;
  290.     short    lsbVolSetSeqNum;
  291.     short    msbVolSetSeqNum;    /* which volume in volume set contains this file. */
  292.     byte    len_fi;                /* length of file identifier which follows */
  293.     char    fi[37];                /* file identifier: actual is 37-[36+Len_fi].
  294.                                     contains extra blank byte if Len_fi odd */
  295.     AppleExtension    apple;        /* this actually fits immediately after the fi[] */
  296.                                 /* field, or after its padding byte. */
  297. } DirRcd, *DirRcdPtr;
  298.     
  299.  
  300.